//
//  Result+Extension.swift
//  Social
//
//  Created by 李响 on 2019/5/31.
//  Copyright © 2019 shengsheng. All rights reserved.
//

import Foundation

extension Result {
    
    var value: Success? {
        switch self {
        case .success(let value):   return value
        case .failure:              return nil
        }
    }
    
    var error: Failure? {
        switch self {
        case .failure(let error):   return error
        case .success:              return nil
        }
    }
    
    var isSuccess: Bool {
        switch self {
        case .success:              return true
        case .failure:              return false
        }
    }
}
